$.fn.OpenSelectLayer = function (entity, option) {
    $(this).attr("readonly",true);
    $(this).on("click", function () {
        var entities = {
            User: "用户",
            Product: "商品"
        };
        var setting = {
            limit: 1,//最多选择数据条数
            fetchData: undefined,//接收返回数据的方法
            width: "60%",
            height: "80%",
            floor: window,
            invoker: this
        };

        if (option != undefined) {
            $.extend(setting, option);
        }
        if (entity == undefined) return;

        entity = entity.substring(0, 1).toUpperCase() + entity.substring(1);
        setting.floor.DGG.Layer.open("/sc/general/commonLayer/select" + entity + ".html", {
            title: "选择" + entities[entity],
            area: [setting.width, setting.height],
            btn: "",
            success: function (layer, index) {
                var fd = $(layer).find("iframe")[0].contentWindow.document;
                fd.selectLimit = setting.limit;
                fd.fetchData = setting.fetchData;
                fd.selectInvoker = setting.invoker;
            }
        });

    });

}